﻿using System.Collections.Generic;
using System.Collections;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
using System;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.Xml.Schema;

namespace ScormModel
{
    [Serializable()]
    public class MapInfo
    {
        private string _targetObjectiveID;
        private string _readSatisfiedStatus;
        private string _readNormalizedMeasure;
        private string _writeSatisfiedStatus;
        private string _writeNormalizedMeasure;
         [NonSerialized]
        private XmlNode _mapInfoContent;
        [XmlAttribute("targetObjectiveID")]
        public string TargetObjectiveID
        {
            get { return this._targetObjectiveID; }
            set { this._targetObjectiveID = value; }
        }
        [XmlAttribute("readSatisfiedStatus")]
        public string ReadSatisfiedStatus
        {
            get { return this._readSatisfiedStatus; }
            set { this._readSatisfiedStatus = value; }
        }
        [XmlAttribute("readNormalizedMeasure")]
        public string ReadNormalizedMeasure
        {
            get { return this._readNormalizedMeasure; }
            set { this._readNormalizedMeasure = value; }
        }
        [XmlAttribute("writeSatisfiedStatus")]
        public string WriteSatisfiedStatus
        {
            get { return this._writeSatisfiedStatus; }
            set { this._writeSatisfiedStatus = value; }
        }
        [XmlAttribute("writeNormalizedMeasure")]
        public string WriteNormalizedMeasure
        {
            get { return this._writeNormalizedMeasure; }
            set { this._writeNormalizedMeasure = value; }
        }
        
        [XmlIgnoreAttribute]
        public XmlNode MapInfoContent
        {
            get { return this._mapInfoContent; }
            set { this._mapInfoContent = value; }
        }
        public void buildMapInfo()
        {
            XmlAttributeCollection attList = _mapInfoContent.Attributes;
            if (attList.GetNamedItem("targetObjectiveID") != null)
            {
                _targetObjectiveID = ((XmlAttribute)attList.GetNamedItem("targetObjectiveID")).Value;
            }
            if (attList.GetNamedItem("readSatisfiedStatus") != null)
            {
                _readSatisfiedStatus = ((XmlAttribute)attList.GetNamedItem("readSatisfiedStatus")).Value;
            }
            if (attList.GetNamedItem("readNormalizedMeasure") != null)
            {
                _readNormalizedMeasure = ((XmlAttribute)attList.GetNamedItem("readNormalizedMeasure")).Value;
            }
            if (attList.GetNamedItem("writeSatisfiedStatus") != null)
            {
                _writeSatisfiedStatus = ((XmlAttribute)attList.GetNamedItem("writeSatisfiedStatus")).Value;
            }
            if (attList.GetNamedItem("writeNormalizedMeasure") != null)
            {
                _writeNormalizedMeasure = ((XmlAttribute)attList.GetNamedItem("writeNormalizedMeasure")).Value;
            }
        }
    }
}
